#include "SWMonitor.h"

SWMonitor::SWMonitor(SW1248& sw1248):_sw1248(sw1248)
{
    _store_obj.obj = nullptr;
    _cb = nullptr;
}
SWMonitor::~SWMonitor()
{

}

void SWMonitor::schedule()
{
    if(_sw1248.changed()){
        if( (millis()-_sw1248.last_millis())>6000){
            if(_cb){
                _cb();
            }else if(_store_obj.obj){
                ((_model_function_object::_class*)(_store_obj.obj)->*(_store_obj._methodfunc))();
            }
            _sw1248.cleanup();
        }
    }
}
void SWMonitor::update()
{
    //
}
void SWMonitor::cleanup()
{
    //
}

